package org.arpit.tutorial.shapes;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.shape.ArcTo;
import javafx.scene.shape.HLineTo;
import javafx.scene.shape.LineTo;
import javafx.scene.shape.MoveTo;
import javafx.scene.shape.Path;
import javafx.scene.shape.QuadCurveTo;
import javafx.stage.Stage;

public class PathDemo extends Application{
	public static void main(String[] args) {
		Application.launch(args);
	}

	@Override
	public void start(Stage primaryStage) {
		primaryStage.setTitle("Shapes Demo");
		VBox vbox = new VBox();
		vbox.setPadding(new Insets(10));
		vbox.setSpacing(10);
		vbox.setStyle("-fx-border-color:blue");
		Scene scene = new Scene(vbox, 600, 600);
		
		//--------------------------------------------------------------------------
		Label label = new Label("Shapes Demo");
		
		Path path = new Path();

		MoveTo moveTo = new MoveTo();
		moveTo.setX(0.0f);
		moveTo.setY(0.0f);

		HLineTo hLineTo = new HLineTo();
		hLineTo.setX(70.0f);

		QuadCurveTo quadCurveTo = new QuadCurveTo();
		quadCurveTo.setX(120.0f);
		quadCurveTo.setY(60.0f);
		quadCurveTo.setControlX(100.0f);
		quadCurveTo.setControlY(0.0f);

		LineTo lineTo = new LineTo();
		lineTo.setX(175.0f);
		lineTo.setY(55.0f);

		ArcTo arcTo = new ArcTo();
		arcTo.setX(50.0f);
		arcTo.setY(50.0f);
		arcTo.setRadiusX(50.0f);
		arcTo.setRadiusY(50.0f);

		path.getElements().add(moveTo);
		path.getElements().add(hLineTo);
		path.getElements().add(quadCurveTo);
		path.getElements().add(lineTo);
		path.getElements().add(arcTo);
		
		
		vbox.getChildren().addAll(label, path);
		
		//--------------------------------------------------------------------------
		
		primaryStage.setScene(scene);
		primaryStage.show();
	}

}
